#include<iostream>
#include<algorithm>
using namespace std;
int n, m;
int main()
{
	int ma = -1e9;
	int idx = 1e9;
	for (int i = 1; i <= 7; i++) {
		int a, b;
		cin >> a >> b;
		if (a + b > ma) {
			ma = a + b;
			idx = i;
		}
	}
	if (ma > 8)  cout << idx << endl;
	else cout << 0 << endl;
	return 0;
}